FROM php:7.4-cli

# Install extension
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/

RUN install-php-extensions gd

# Use the default production configuration
RUN cp "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
    && sed -e 's|^memory_limit = 128M|memory_limit = 2048M|g' \
        -i.bak \
        "$PHP_INI_DIR/php.ini"

WORKDIR /app

COPY ./watermark.* /app

CMD [ "php", "./watermark.php" ]

# docker build -t watermark-php .
# docker run -it -v /input:/app/imgs -v /output:/app/out --rm --name watermark-running watermark-php